package com.example.controller;

import com.example.entity.User;
import com.example.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "用户管理")
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @ApiOperation("获取用户信息")
    @GetMapping("/info")
    public User getUserInfo(@RequestParam Integer userId) {
        return userService.getUserInfo(userId);
    }

    @ApiOperation("更新用户信息")
    @PostMapping("/update")
    public void updateUserInfo(@RequestBody User user) {
        userService.updateUserInfo(user);
    }
}